<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.FileInputStream" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/6/14 0014
  Time: 17:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String f = request.getParameter("f");
    OutputStream o = response.getOutputStream();
    String path = application.getRealPath("/tuji");
    String imgpath = path+"/"+f;
    response.addHeader("Content-Disposition","attachment;filename="+f);
    FileInputStream in = new FileInputStream(imgpath);
    byte[] buffer = new byte[1024];
    while(true){
        int n = in.read(buffer);
        if(n == -1){
            break;
        }
        o.write(buffer,0,n);
        o.flush();
    }
%>